$OpenBSD: patch-go-pear,v 1.4 2014/10/30 11:57:59 sthen Exp $
--- go-pear.orig	Wed Oct 29 14:15:56 2014
+++ go-pear	Wed Oct 29 14:16:09 2014
@@ -50,7 +50,7 @@ define('WEBINSTALLER', ($sapi_name != 'cli' && !(subst
 ini_set('track_errors', true);
 ini_set('html_errors', WEBINSTALLER);
 ini_set('magic_quotes_runtime', false);
-error_reporting( E_ALL & ~E_NOTICE);
+error_reporting( E_ALL & ~E_NOTICE & ~E_DEPRECATED );
 
 define('WINDOWS', (substr(PHP_OS, 0, 3) == 'WIN'));
 define('GO_PEAR_VER', '1.1.2');
@@ -116,7 +116,7 @@ $bootstrap_pkgs = array( // uses URL like http://pear.
 );
 
 $installer_packages = array(
-    'PEAR',
+    'PEAR-stable',
     'Structures_Graph-stable',
     'Archive_Tar-stable',
     'Console_Getopt-stable',
@@ -251,6 +251,7 @@ if (WEBINSTALLER) {
     // Anything past this step has something to do with the installation    
 }
 
+/*
 if (!WEBINSTALLER) {
     $tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r');
 
@@ -294,6 +295,7 @@ If you wish to abort, press Control-C now, or press En
         $http_proxy = $tmp;
     }
 }
+*/
 
 $origpwd = getcwd();
 
@@ -346,6 +348,7 @@ we strongly recommand to use it.
     }
 }
 
+/*
 while (!WEBINSTALLER) {
     print "
 Below is a suggested file layout for your new PEAR installation.  To
@@ -428,6 +431,7 @@ If you have a CLI (or CGI) php.exe available, we stron
         }
     }
 }
+*/
 
 ####
 # Installation stuff
@@ -562,6 +566,7 @@ if (WEBINSTALLER) {
     }
 }
 
+/*
 if (!WEBINSTALLER) {
     $msg = "The following PEAR packages are bundled with PHP: " .
         implode(', ', array_keys($pfc_packages));
@@ -571,17 +576,19 @@ if (!WEBINSTALLER) {
     $install_optional_packages = array();
     print "\n";
 }
+*/
 
 ####
 # Download
 ####
 
 if (function_exists('set_include_path')) {
-   set_include_path($ptmp);
+   set_include_path($ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
 } else {
-   ini_set('include_path', $ptmp);
+   ini_set('include_path', $ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
 }
 
+/*
 if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could be in multithread env which makes dl() end up with a fatal error.
     if (WINDOWS) {
         @dl('php_zlib.dll');
@@ -606,18 +613,21 @@ print "Loading zlib: ".($have_gzip ? 'ok' : 'failed').
 if (!$have_gzip) {
     print "Downloading uncompressed packages\n";
 };
+*/
 
 if ($install_pfc) {
     $to_install = array_merge($installer_packages, array_keys($pfc_packages));
 } else {
     $to_install = $installer_packages;
 
+/*
     // webinstaller allows to choose pfc packages individually
     foreach ($pfc_packages as $pkg => $desc) {
         if (in_array($pkg, $install_optional_packages)) {
             array_push($to_install, $pkg);
         }
     }
+*/
 }
 
 // gopear_bundle usage
@@ -655,9 +665,9 @@ if (is_dir($php_dir)) {
 if ($nobootstrap) {
     print('Using previously install ... ');
     if (function_exists('set_include_path')) {
-        set_include_path($php_dir);
+        set_include_path($php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
     } else {
-        ini_set('include_path', $php_dir);
+        ini_set('include_path', $php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
     }
     include_once 'PEAR.php';
     print "ok\n";
@@ -750,7 +760,7 @@ include_once "PEAR/Registry.php";
 if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
     $config = &PEAR_Config::singleton($prefix."/pear.conf", '');
 } else {
-    $config = &PEAR_Config::singleton();
+    $config = &PEAR_Config::singleton($prefix."/etc/pear.conf", '');
 }
 
 
@@ -768,11 +778,13 @@ $config->store();
 $registry = new PEAR_Registry($php_dir);
 PEAR_Command::setFrontendType('CLI');
 
+/*
 PEAR::staticPushErrorHandling(PEAR_ERROR_DIE); //fail silently
 $ch_cmd = &PEAR_Command::factory('update-channels', $config);
 $ch_cmd->run('update-channels', $options, array());
 PEAR::staticPopErrorHandling(); // reset error handling
 unset($ch_cmd);
+*/
 
 
 print "\n".'Installing selected packages..................'."\n";
@@ -821,7 +833,7 @@ displayHTMLProgress($progress = 99);
 
 
 // Base installation finished
-
+/*
 ini_restore("include_path");
 
 if (!WEBINSTALLER) {
@@ -980,6 +992,8 @@ if ( WINDOWS ) {
 if (WINDOWS && !WEBINSTALLER) {
     win32CreateRegEnv();
 }
+*/
+
 // Set of functions following
 /**
  * Parse the given dirname
@@ -1418,19 +1432,18 @@ function detect_install_dirs($_prefix = null) {
         }
     } else {
         if ($_prefix === null) {
-            #$prefix    = dirname(PHP_BINDIR);
-            $prefix    = dirname(__FILE__);
+            $prefix    = '%%PREFIX%%';
         } else {
             $prefix = $_prefix;
         }
         $bin_dir   = '$prefix/bin';
         #$php_dir   = '$prefix/share/pear';
-        $php_dir   = '$prefix/PEAR';
-        $doc_dir   = '$php_dir/docs';
-        $data_dir  = '$php_dir/data';
-        $test_dir  = '$php_dir/tests';
-        $temp_dir   = '$prefix/temp';
-
+        $php_dir   = '$prefix/pear/lib';
+        $doc_dir   = '$prefix/share/doc/pear';
+        $data_dir  = '$prefix/pear/data';
+        $test_dir  = '$prefix/pear/tests';
+        $temp_dir   = '%%TMPDIR%%';
+/*
         // check if the user has installed PHP with PHP or GNU layout
         if (@is_dir("$prefix/lib/php/.registry")) {
             $php_dir = '$prefix/lib/php';
@@ -1442,6 +1455,7 @@ function detect_install_dirs($_prefix = null) {
         } elseif (@is_dir("$prefix/share/php/.registry")) {
             $php_dir = '$prefix/share/php';
         }
+*/
     }
 }
 
